// Copyright (c) 2009 Hypirinha contributers
// This program is made available under the terms of the MIT License.
package org.hypirinha.html.output.print;

import static org.hypirinha.html.ElementFactory.div;
import org.hypirinha.html.elements.Div;
import org.hypirinha.html.output.PrintAdapter;
import static org.junit.Assert.assertEquals;
import org.junit.Test;

public class PrintAdapterLargerScaleTest {
    
    @Test
    public void shouldCopeWithDeeplyNestedElements() {
        Div root = div();
        Div div = root;
        for (int i = 0; i < 1000; i++) {
            div = div.div();
        }
        String output = new PrintAdapter().asString(root);
        String[] lines = output.split("\n");
        assertEquals(2001, lines.length);
    }

    @Test
    public void shouldCopeWithManySiblingElements() {
        Div div = div();
        for (int i = 0; i < 1000; i++) {
            div.div();
        }
        String output = new PrintAdapter().asString(div);
        String[] lines = output.split("\n");
        assertEquals(1002, lines.length);
    }
}